Fix shortcuts section reflow
authorMatthias Clasen <mclasen@redhat.com>
Tue, 14 Jul 2020 18:47:23 +0000 (14:47 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 14 Jul 2020 18:48:32 +0000 (14:48 -0400)
When this code was ported from gtk_container_get_children
to the dom api, we inadvertendly inverted the order of the
list in one place. With the dom api, we can just avoid
reversing lists altogether, so do that.

Fixes: #2928
gtk/gtkshortcutssection.c

index 7aef6791f57b4d91333f0ef9ba4f991fae526843..5f5be70582fe5d4711b246a86d6f654a2661e24d 100644 (file)
@@ -543,21 +543,20 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self)
     {
       GtkWidget *column;
 
-      for (column = gtk_widget_get_first_child (page);
+      for (column = gtk_widget_get_last_child (page);
            column != NULL;
-           column = gtk_widget_get_next_sibling (column))
+           column = gtk_widget_get_prev_sibling (column))
         {
           GtkWidget *group;
 
-          for (group = gtk_widget_get_first_child (column);
+          for (group = gtk_widget_get_last_child (column);
                group != NULL;
-               group = gtk_widget_get_next_sibling (group))
+               group = gtk_widget_get_prev_sibling (group))
             {
               groups = g_list_prepend (groups, group);
             }
         }
     }
-  groups = g_list_reverse (groups);
 
   /* create new pages */
   current_page = NULL;
@@ -642,7 +641,6 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self)
            child != NULL;
            child = gtk_widget_get_prev_sibling (child))
         content = g_list_prepend (content, child);
-      content = g_list_reverse (content);
       n = 0;
 
       for (g = g_list_last (content); g; g = g->prev)